.class public Lcom/estrongs/android/taskmanager/tools/ApplicationMan;
.super Ljava/lang/Object;


# static fields
.field static final TAG:Ljava/lang/String; = "ApplicationMan"

.field static freeStorageAndNotify:Ljava/lang/reflect/Method;

.field static getPackageSizeInfo:Ljava/lang/reflect/Method;


# instance fields
.field private mPm:Landroid/content/pm/PackageManager;


# direct methods
.method static constructor <clinit>()V
    .locals 4

    const/4 v0, 0x2

    const/4 v3, 0x1

    const/4 v2, 0x0

    new-array v0, v0, [Ljava/lang/Class;

    sget-object v1, Ljava/lang/Long;->TYPE:Ljava/lang/Class;

    aput-object v1, v0, v2

    const-class v1, Landroid/content/pm/IPackageDataObserver;

    aput-object v1, v0, v3

    :try_start_0
    const-class v1, Landroid/content/pm/PackageManager;

    const-string v2, "freeStorageAndNotify"

    invoke-virtual {v1, v2, v0}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v0

    sput-object v0, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->freeStorageAndNotify:Ljava/lang/reflect/Method;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    const/4 v0, 0x2

    :try_start_1
    new-array v0, v0, [Ljava/lang/Class;

    const/4 v1, 0x0

    const-class v2, Ljava/lang/String;

    aput-object v2, v0, v1

    const/4 v1, 0x1

    const-class v2, Landroid/content/pm/IPackageStatsObserver;

    aput-object v2, v0, v1

    const-class v1, Landroid/content/pm/PackageManager;

    const-string v2, "getPackageSizeInfo"

    invoke-virtual {v1, v2, v0}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v0

    sput-object v0, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->getPackageSizeInfo:Ljava/lang/reflect/Method;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    :goto_1
    return-void

    :catch_0
    move-exception v0

    const-string v1, "ApplicationMan"

    const-string v2, "Get the metohd freeStorageAndNotify failed."

    invoke-static {v1, v2, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0

    :catch_1
    move-exception v0

    const-string v1, "ApplicationMan"

    const-string v2, "Get the metohd getPackageSizeInfo failed."

    invoke-static {v1, v2, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_1
.end method

.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v0

    iput-object v0, p0, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->mPm:Landroid/content/pm/PackageManager;

    return-void
.end method


# virtual methods
.method public cleanAllCache()V
    .locals 5

    invoke-static {}, Landroid/os/Environment;->getDataDirectory()Ljava/io/File;

    move-result-object v0

    new-instance v1, Landroid/os/StatFs;

    invoke-virtual {v0}, Ljava/io/File;->getPath()Ljava/lang/String;

    move-result-object v0

    invoke-direct {v1, v0}, Landroid/os/StatFs;-><init>(Ljava/lang/String;)V

    const/4 v0, 0x2

    :try_start_0
    new-array v0, v0, [Ljava/lang/Object;

    const/4 v2, 0x0

    invoke-virtual {v1}, Landroid/os/StatFs;->getBlockCount()I

    move-result v3

    invoke-virtual {v1}, Landroid/os/StatFs;->getBlockSize()I

    move-result v1

    mul-int/2addr v1, v3

    int-to-long v3, v1

    invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v1

    aput-object v1, v0, v2

    const/4 v1, 0x1

    new-instance v2, Lcom/estrongs/android/taskmanager/tools/c;

    invoke-direct {v2}, Lcom/estrongs/android/taskmanager/tools/c;-><init>()V

    aput-object v2, v0, v1

    sget-object v1, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->freeStorageAndNotify:Ljava/lang/reflect/Method;

    iget-object v2, p0, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->mPm:Landroid/content/pm/PackageManager;

    invoke-virtual {v1, v2, v0}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;

    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/Object;

    const/4 v1, 0x0

    const-wide v2, 0x63ffffff38L

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    aput-object v2, v0, v1

    const/4 v1, 0x1

    new-instance v2, Lcom/estrongs/android/taskmanager/tools/c;

    invoke-direct {v2}, Lcom/estrongs/android/taskmanager/tools/c;-><init>()V

    aput-object v2, v0, v1

    sget-object v1, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->freeStorageAndNotify:Ljava/lang/reflect/Method;

    iget-object v2, p0, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->mPm:Landroid/content/pm/PackageManager;

    invoke-virtual {v1, v2, v0}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    const-string v1, "ApplicationMan"

    const-string v2, "Clean cache failed."

    invoke-static {v1, v2, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    const/4 v0, 0x2

    :try_start_1
    new-array v0, v0, [Ljava/lang/Object;

    const/4 v1, 0x0

    const-wide v2, 0x63ffffff38L

    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    aput-object v2, v0, v1

    const/4 v1, 0x1

    new-instance v2, Lcom/estrongs/android/taskmanager/tools/c;

    invoke-direct {v2}, Lcom/estrongs/android/taskmanager/tools/c;-><init>()V

    aput-object v2, v0, v1

    sget-object v1, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->freeStorageAndNotify:Ljava/lang/reflect/Method;

    iget-object v2, p0, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->mPm:Landroid/content/pm/PackageManager;

    invoke-virtual {v1, v2, v0}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    goto :goto_0

    :catch_1
    move-exception v0

    const-string v1, "ApplicationMan"

    const-string v2, "Clean cache failed."

    invoke-static {v1, v2, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0
.end method

.method public fetchPackageStats(Ljava/lang/String;Landroid/content/pm/IPackageStatsObserver;)V
    .locals 3

    const/4 v0, 0x2

    new-array v0, v0, [Ljava/lang/Object;

    const/4 v1, 0x0

    aput-object p1, v0, v1

    const/4 v1, 0x1

    aput-object p2, v0, v1

    :try_start_0
    sget-object v1, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->getPackageSizeInfo:Ljava/lang/reflect/Method;

    iget-object v2, p0, Lcom/estrongs/android/taskmanager/tools/ApplicationMan;->mPm:Landroid/content/pm/PackageManager;

    invoke-virtual {v1, v2, v0}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    const-string v1, "ApplicationMan"

    const-string v2, "Fetch package stats failed. "

    invoke-static {v1, v2, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0
.end method
